[C] Add ringzero-ws - WebSocket#815
Merged
Merged
Conversation
Hand-rolled WebSocket echo server on raw io_uring (liburing), with no WebSocket library. Multishot accept + multishot recv into a provided buffer ring give zero-copy ingest; the RFC 6455 handshake (with from-scratch SHA-1 + base64), frame parser/masking, and batched echo write path are implemented directly against io_uring completions. One ring per core with SO_REUSEPORT, matching the ringzero engine. Subscribes to echo-ws and echo-ws-pipeline. Passes validate-ws.py (7/7) plus large-frame / pipelined / concurrent stress tests via the Docker build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
/benchmark -f ringzero-ws |
Contributor
|
👋 |
Contributor
Benchmark ResultsFramework:
Full log |
Owner
Author
|
/benchmark -f ringzero-ws --save |
Contributor
|
👋 |
Contributor
Benchmark ResultsFramework:
Full log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A WebSocket echo server written directly on raw io_uring (liburing), with the WebSocket protocol hand-rolled — no
tokio-tungstenite, no library WS stack. It's the io_uring sibling of theringzeroHTTP engine.Added as an
engine-tier entry: the lowest-level way to serveecho-wson the modern Linux completion-based I/O path.The "ring-zero" I/O path
io_uringper core, each with its ownSO_REUSEPORTlistener — kernel-sharded accept, no shared queue, no cross-core work-stealing.io_uring_setup_buf_ring); frames are parsed in place and the buffer is recycled immediately (zero-copy ingest).IORING_SETUP_SINGLE_ISSUER | DEFER_TASKRUNfor the single-thread-per-ring fast path (with a fallback for older kernels). Echoes are batched into a per-connection write queue; the in-flight chunk is sealed so the kernel never sees a reallocated buffer.Hand-rolled WebSocket
Sec-WebSocket-Acceptderivation,101reply, with from-scratch SHA-1 + base64. liburing is the only dependency.Ping→Pong,Closeechoed.Tests
Subscribes to
echo-wsandecho-ws-pipeline. Passesvalidate-ws.py(7/7), plus 200 KB-frame (multi-buffer reassembly), 2,000-frame pipelined, and 50-connection concurrent stress tests via the Docker build.🤖 Generated with Claude Code